package com.kfm;

public class Phone {

    // 修改字段的访问修饰符 以此来控制字段的可见性
    private String name;
    private double price;
    private int size;
    private String type;
    private String color;

    // 给字段设置 getter/setter 方法
    public String getName() {
        return this.name;
    }

    public double getPrice() {
        return this.price;
    }

    public int getSize() {
        return this.size;
    }

    public String getType() {
        return this.type;
    }

    public String getColor() {
        return this.color;
    }

    public void setName(String name) {
        this.name = name;
    }


    public void setSize(int size) {
        if (size > 0) {
            this.size = size;
        } else {
            this.size = 16;
        }
    }

    public void setType(String type) {
        this.type = type;
    }
    public void setPrice(double price) {
        this.price = price;
    }

    public void setColor(String color) {
        this.color = color;
    }
}
